<?php

App::uses('AppModel', 'Model');

class Area extends AppModel {

       
        public $validate = array(
            'name' => array(
                'rule' => array('minLength', 1),
                'message' => 'Name cannot be empty.',
            ),
            'alias' => array(
                'isUnique' => array(
                    'rule' => 'isUnique',
                    'message' => 'This alias has already been taken.',
                ),
                'minLength' => array(
                    'rule' => array('minLength', 1),
                    'message' => 'Alias cannot be empty.',
                ),
            ),
        );

        /**
         * Filter search fields
         *
         * @var array
         * @access public
         */
        public $filterArgs = array(
            'name' => array('type' => 'like', 'field' => array('Area.name', 'Area.alias'))
        );

        /**
         * Model associations: hasMany
         *
         * @var array
         * @access public
         */
        public $hasMany = array(
            'City' => array(
                'className' => 'City',
                'foreignKey' => 'area_id',
                'dependent' => true,
                'conditions' => '',
                'fields' => '',
                'order' => 'City.weight ASC',
                'limit' => '',
                'offset' => '',
                'exclusive' => '',
                'finderQuery' => '',
                'counterQuery' => '',
            ),
        );

}

?>